import { FuzhiModule } from './modules/app/Features/fuzhiApi/fuzhi.module';
import { BaominModule } from './modules/app/Features/baominApi/baomin.module';
import { ZhuceModule } from './modules/app/Features/zhuceApi/zhuce.module';
import { JihuoModule } from './modules/app/Features/jihuoApi/jihuo.module';
import { OperatModule } from './modules/app/operatApi/operat.module';
import { HomeModule } from './modules/web/homeApi/home.module';
import { ChannelModule } from './modules/web/channelApi/channel.module';
import { ContactModule } from './modules/web/contactApi/contact.module';
import { AdvModule } from './modules/web/lunboApi/lunbo.module';
import { JobModule } from './modules/web/jobApi/job.module';
import { CompanyModule } from './modules/web/companyApi/company.module';
import { AppUserController } from './modules/web/appUserApi/appuser.controller';
import { AppUserModule } from './modules/web/appUserApi/appuser.module';
import { UserModule } from './modules/web/userApi/user.module';
import { AdModule } from './modules/app/lunboApi/banner.module';
import { WorkModule } from './modules/app/workApi/work.module';
import { LoginModule } from './modules/app/loginApi/login.module';
import { MongoModule } from './mongodb/mongo.module';
import { RedisdbModule } from './redis/redisdb.module';
import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import './mongodb/models/userModel/Init.models'
import { AppMiddleware } from './app.middleware';
import { ScheduleModule } from '@nestjs/schedule';

@Module({
  imports: [
    FuzhiModule,
    BaominModule,
    ZhuceModule,
    JihuoModule,
    OperatModule,
    HomeModule,
    ChannelModule,
    ContactModule,
    AdvModule,
    JobModule,
    CompanyModule,
    AppUserModule,
    UserModule,
    AdModule,
    WorkModule,
    LoginModule,
    MongoModule,
    RedisdbModule,
    ScheduleModule.forRoot()
  ],
  controllers: [
    AppUserController, AppController],
  providers: [AppService],
})
export class AppModule implements NestModule {
  configure(consumer: MiddlewareConsumer) {
    consumer
      .apply(AppMiddleware)
      .forRoutes('index', 'login')

  }
}
